/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Vista;

import Validacion.ValidaCliente;
import java.awt.event.ItemEvent;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import Modelo.Cliente;
import Modelo.Producto;
import Validacion.ValidaProducto;
import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel;

/**
 *
 * @author bastian
 */
public class Panel_Producto extends javax.swing.JPanel {

    /**
     * Creates new form Panel_Cliente
     */
    public Panel_Producto() {
        initComponents();
    }
    
    private VentanaPrincipal V_Principal;
    private Panel_ResumenRecepcion P_Resumen;
    private boolean esReJudicial, esReVoluntaria, esOtro;
    
    public void setFrame(JFrame f){
        this.V_Principal= (VentanaPrincipal) f;
    }
    
    public void setPanelResumen(JPanel f){
        P_Resumen= (Panel_ResumenRecepcion) f;
    }
    
    private void Limpiar(){
        
        this.TextField_ID.setText("");
        this.jTextField_Garantia.setText("");
        this.jTextArea_DeLarga.setText("");
        this.jTextField_Descripcion.setText("");
        this.jTextField_PrecioT.setText("");
        this.jTextField_PrecioU.setText("");
        this.jSpinner_Cantidad.setValue(1);
        this.jSpinner_NumLote.setValue(1);
        
        this.jSpinner_Cantidad.setModel(new SpinnerNumberModel(1, 1, 1000, 1));
        this.jSpinner_NumLote.setModel(new SpinnerNumberModel(1, 1, 1000, 1));
    }
    
    
    public void esReJudicial(){
        esReJudicial = true;
        esReVoluntaria = false;
        esOtro= false;
    }
    
    public void esReVoluntaria(){
        esReVoluntaria = true;
        esReJudicial = false;
        esOtro = false;
    }
    
    public void esOtro(){
        esOtro = true;
        esReVoluntaria = false;
        esReJudicial = false;
    }
    public ArrayList getDatos(){
    
        ArrayList datos = new ArrayList();
        
        datos.add(this.TextField_ID.getText());
        datos.add(this.jTextField_Descripcion.getText());
        datos.add(this.jSpinner_Cantidad.getValue());
        datos.add(this.jTextField_PrecioU.getText());
        datos.add(this.jTextField_PrecioT.getText());
        datos.add(this.jTextField_Garantia.getText());
        datos.add(this.jTextArea_DeLarga.getText());
        
        return datos;
    }
    
    protected void ProductoNuevo(boolean b){
        this.Limpiar();
        this.TextField_ID.setVisible(b);
        this.Label_ID.setVisible(b);
        this.jButton_Buscar.setEnabled(!b);
        this.jButton_Modificar.setEnabled(!b);
        
        this.jSpinner_Cantidad.setEnabled(b);
        this.jSpinner_NumLote.setEnabled(b);
        this.jTextField_Garantia.setEditable(b);
        this.jTextField_PrecioU.setEditable(b);
        this.jTextArea_DeLarga.setEditable(b);
        this.jTextField_Descripcion.setEditable(b);
        this.esReJudicial = b;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel_Producto = new javax.swing.JLabel();
        jSpinner_Cantidad = new javax.swing.JSpinner();
        jLabel_Cantidad = new javax.swing.JLabel();
        jLabel_NumLote = new javax.swing.JLabel();
        Label_ID = new javax.swing.JLabel();
        jSpinner_NumLote = new javax.swing.JSpinner();
        jButton_Buscar = new javax.swing.JButton();
        jLabel_Garantia = new javax.swing.JLabel();
        TextField_ID = new javax.swing.JTextField();
        jTextField_Garantia = new javax.swing.JTextField();
        jButton_Modificar = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea_DeLarga = new javax.swing.JTextArea();
        jLabel_PrecioU = new javax.swing.JLabel();
        jTextField_PrecioT = new javax.swing.JTextField();
        jTextField_Descripcion = new javax.swing.JTextField();
        jLabel_DeLarga = new javax.swing.JLabel();
        jLabel_Descripcion = new javax.swing.JLabel();
        jTextField_PrecioU = new javax.swing.JTextField();
        jLabel_PrecioT = new javax.swing.JLabel();
        jButton_Aceptar = new javax.swing.JButton();
        jButton_Cancelar = new javax.swing.JButton();
        label_Producto481 = new Vista.Imagenes_Label.producto.Label_Producto48();

        setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        setMaximumSize(new java.awt.Dimension(1000, 550));
        setMinimumSize(new java.awt.Dimension(1000, 550));
        setName("Cliente");
        setPreferredSize(new java.awt.Dimension(1000, 550));

        jLabel_Producto.setFont(new java.awt.Font("Arial", 0, 36)); // NOI18N
        jLabel_Producto.setText("Producto");

        jSpinner_Cantidad.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jSpinner_Cantidad.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jSpinner_CantidadStateChanged(evt);
            }
        });

        jLabel_Cantidad.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        jLabel_Cantidad.setText("Cantidad");

        jLabel_NumLote.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        jLabel_NumLote.setText("Nº Lote");

        Label_ID.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        Label_ID.setText("ID");

        jSpinner_NumLote.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N

        jButton_Buscar.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jButton_Buscar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Imagenes_Files/buscar/24.png"))); // NOI18N
        jButton_Buscar.setText("Buscar");

        jLabel_Garantia.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        jLabel_Garantia.setText("Garantía");

        TextField_ID.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        TextField_ID.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                TextField_IDKeyTyped(evt);
            }
        });

        jTextField_Garantia.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jTextField_Garantia.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextField_GarantiaKeyTyped(evt);
            }
        });

        jButton_Modificar.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jButton_Modificar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Imagenes_Files/modificar/documentos/24.png"))); // NOI18N
        jButton_Modificar.setText("Modificar");

        jTextArea_DeLarga.setColumns(20);
        jTextArea_DeLarga.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
        jTextArea_DeLarga.setRows(5);
        jTextArea_DeLarga.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextArea_DeLargaKeyTyped(evt);
            }
        });
        jScrollPane1.setViewportView(jTextArea_DeLarga);

        jLabel_PrecioU.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        jLabel_PrecioU.setText("Precio Unitario");

        jTextField_PrecioT.setEditable(false);
        jTextField_PrecioT.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N

        jTextField_Descripcion.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N

        jLabel_DeLarga.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        jLabel_DeLarga.setText("Descripción Larga (máximo 3000 caracteres)");

        jLabel_Descripcion.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        jLabel_Descripcion.setText("Descripción");

        jTextField_PrecioU.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jTextField_PrecioU.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextField_PrecioUKeyTyped(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTextField_PrecioUKeyReleased(evt);
            }
        });

        jLabel_PrecioT.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        jLabel_PrecioT.setText("Precio Total");

        jButton_Aceptar.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jButton_Aceptar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Imagenes_Files/tick/24.png"))); // NOI18N
        jButton_Aceptar.setText("Aceptar");
        jButton_Aceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_AceptarActionPerformed(evt);
            }
        });

        jButton_Cancelar.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jButton_Cancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Vista/Imagenes_Files/cruz/24.png"))); // NOI18N
        jButton_Cancelar.setText("Cancelar");
        jButton_Cancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_CancelarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel_Producto)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(label_Producto481, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(45, 45, 45)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel_DeLarga)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addGroup(layout.createSequentialGroup()
                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel_Garantia)
                                                .addComponent(jLabel_Cantidad)
                                                .addComponent(Label_ID))
                                            .addGap(32, 32, 32)
                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(layout.createSequentialGroup()
                                                    .addComponent(TextField_ID, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(18, 18, 18)
                                                    .addComponent(jButton_Buscar)
                                                    .addGap(6, 6, 6)
                                                    .addComponent(jButton_Modificar))
                                                .addGroup(layout.createSequentialGroup()
                                                    .addComponent(jSpinner_Cantidad, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(130, 130, 130)
                                                    .addComponent(jLabel_PrecioU)
                                                    .addGap(18, 18, 18)
                                                    .addComponent(jTextField_PrecioU, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addGroup(layout.createSequentialGroup()
                                                    .addComponent(jTextField_Garantia, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(137, 137, 137)
                                                    .addComponent(jLabel_NumLote)
                                                    .addGap(18, 18, 18)
                                                    .addComponent(jSpinner_NumLote, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                            .addGap(75, 75, 75)
                                            .addComponent(jLabel_PrecioT)
                                            .addGap(18, 18, 18)
                                            .addComponent(jTextField_PrecioT, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                            .addComponent(jLabel_Descripcion)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                            .addComponent(jTextField_Descripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 784, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 886, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(0, 47, Short.MAX_VALUE)))
                        .addGap(0, 12, 12))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton_Aceptar)
                        .addGap(6, 6, 6)
                        .addComponent(jButton_Cancelar)
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel_Producto)
                        .addGap(15, 15, 15)
                        .addComponent(Label_ID))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(label_Producto481, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(6, 6, 6)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(2, 2, 2)
                                .addComponent(TextField_ID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jButton_Buscar)
                                .addComponent(jButton_Modificar)))))
                .addGap(17, 17, 17)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTextField_PrecioU, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField_PrecioT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel_Cantidad)
                                .addComponent(jSpinner_Cantidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel_PrecioU)
                            .addComponent(jLabel_PrecioT))))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSpinner_NumLote, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel_Garantia)
                                .addComponent(jTextField_Garantia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel_NumLote))))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTextField_Descripcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel_Descripcion))
                .addGap(18, 18, 18)
                .addComponent(jLabel_DeLarga, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 9, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton_Aceptar)
                    .addComponent(jButton_Cancelar))
                .addContainerGap())
        );

        this.jSpinner_Cantidad.setModel(new SpinnerNumberModel(1, 1, 1000, 1));
        this.jSpinner_NumLote.setModel(new SpinnerNumberModel(1, 1, 1000, 1));
    }// </editor-fold>//GEN-END:initComponents

    private void jButton_BuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_BuscarActionPerformed
        // TODO add your handling code here:
        V_Principal.addPanel_Busqueda_Cliente(1);
    }//GEN-LAST:event_jButton_BuscarActionPerformed

    private void jSpinner_CantidadStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSpinner_CantidadStateChanged
        // TODO add your handling code here:
        long x;
        Number temp = (Number) this.jSpinner_Cantidad.getValue();
        int n = temp.intValue();
        if (n > 0 && !this.jTextField_PrecioU.getText().isEmpty()) {
            x = Long.parseLong(this.jTextField_PrecioU.getText()) * n;
            this.jTextField_PrecioT.setText(Long.toString(x));
        }
    }//GEN-LAST:event_jSpinner_CantidadStateChanged

    private void TextField_IDKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TextField_IDKeyTyped
        // TODO add your handling code here:
        char c = evt.getKeyChar();

        if (!Character.isDigit(c) || this.TextField_ID.getText().length() > 10) {
            evt.consume();
        }
    }//GEN-LAST:event_TextField_IDKeyTyped

    private void jTextField_GarantiaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField_GarantiaKeyTyped
        // TODO add your handling code here:
        char c = evt.getKeyChar();
        if (!Character.isDigit(c) || this.jTextField_Garantia.getText().length() > 10) {
            evt.consume();
        }
    }//GEN-LAST:event_jTextField_GarantiaKeyTyped

    private void jTextArea_DeLargaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextArea_DeLargaKeyTyped
        // TODO add your handling code here:
        if (this.jTextArea_DeLarga.getText().length() > 1000) {
            evt.consume();
        }
    }//GEN-LAST:event_jTextArea_DeLargaKeyTyped

    private void jTextField_PrecioUKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField_PrecioUKeyTyped
        // TODO add your handling code here:
        char c = evt.getKeyChar();
        if (!Character.isDigit(c) || this.jTextField_PrecioU.getText().length() > 10) {
            evt.consume();
        }
    }//GEN-LAST:event_jTextField_PrecioUKeyTyped

    private void jTextField_PrecioUKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField_PrecioUKeyReleased
        // TODO add your handling code here:
        long x;
        Number temp = (Number) this.jSpinner_Cantidad.getValue();
        int n = temp.intValue();
        if (n > 0 && !this.jTextField_PrecioU.getText().isEmpty()) {
            x = Long.parseLong(this.jTextField_PrecioU.getText()) * n;
            this.jTextField_PrecioT.setText(Long.toString(x));
        } else if (this.jTextField_PrecioU.getText().isEmpty()) {
            this.jTextField_PrecioT.setText("");
        }
    }//GEN-LAST:event_jTextField_PrecioUKeyReleased

    private void jButton_AceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_AceptarActionPerformed
        // TODO add your handling code here:
        
        
        if(ValidaProducto.ProductoValido(this.getDatos())){
            
            if(Producto.isExist(Integer.parseInt(this.TextField_ID.getText()))){
                JOptionPane.showMessageDialog(V_Principal, "ID ya existe", "Error", JOptionPane.ERROR_MESSAGE);
            }         
            
            else{
                P_Resumen.LosProductos.add(this.getDatos());
                P_Resumen.tabla_Producto1.setProductos(P_Resumen.LosProductos);
                P_Resumen.tabla_Producto1.AgregaProductos();
                JOptionPane.showMessageDialog(V_Principal, "Producto agregado correctamente", "Información", JOptionPane.INFORMATION_MESSAGE);
                V_Principal.removePanel(this);

                if(esReJudicial)
                    V_Principal.desbloquearPanel(2);

                else if(esReVoluntaria)
                    V_Principal.desbloquearPanel(1);
            }
        }
        
        else
            JOptionPane.showMessageDialog(V_Principal, "Datos Incorrectos", "Error", JOptionPane.ERROR_MESSAGE);
    }//GEN-LAST:event_jButton_AceptarActionPerformed

    private void jButton_CancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_CancelarActionPerformed
        // TODO add your handling code here:
        this.Limpiar();
        V_Principal.removePanel(this);
        
        if(esReJudicial)
        V_Principal.desbloquearPanel(2);
        
        else if(esReVoluntaria)
            V_Principal.desbloquearPanel(1);
        
    }//GEN-LAST:event_jButton_CancelarActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel Label_ID;
    private javax.swing.JTextField TextField_ID;
    private javax.swing.JButton jButton_Aceptar;
    private javax.swing.JButton jButton_Buscar;
    private javax.swing.JButton jButton_Cancelar;
    private javax.swing.JButton jButton_Modificar;
    private javax.swing.JLabel jLabel_Cantidad;
    private javax.swing.JLabel jLabel_DeLarga;
    private javax.swing.JLabel jLabel_Descripcion;
    private javax.swing.JLabel jLabel_Garantia;
    private javax.swing.JLabel jLabel_NumLote;
    private javax.swing.JLabel jLabel_PrecioT;
    private javax.swing.JLabel jLabel_PrecioU;
    private javax.swing.JLabel jLabel_Producto;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSpinner jSpinner_Cantidad;
    private javax.swing.JSpinner jSpinner_NumLote;
    private javax.swing.JTextArea jTextArea_DeLarga;
    private javax.swing.JTextField jTextField_Descripcion;
    private javax.swing.JTextField jTextField_Garantia;
    private javax.swing.JTextField jTextField_PrecioT;
    private javax.swing.JTextField jTextField_PrecioU;
    private Vista.Imagenes_Label.producto.Label_Producto48 label_Producto481;
    // End of variables declaration//GEN-END:variables
}
